package com.landian.demo.redis.controller;

import com.landian.demo.redis.service.ProductService;
import com.landian.demo.redis.vo.ProductVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author caojl
 * @date: 2018-06-15
 * @time: 14:26
 */
@RestController
@RequestMapping("/product")
@Slf4j
public class ProductController {

    @Autowired
    private ProductService productService;

    @GetMapping("/list")
    public List<ProductVO> list() {
        log.info("list");
        return productService.list();
    }

    @GetMapping("/get")
    public ProductVO get(@RequestParam String name) {
        log.info("get");
        return productService.findProduct(name);
    }
}
